There are many prior art techniques for using computers to display (i.e., render) realistic graphical images. In an effort to standardize such techniques, graphics application programming interfaces (APIs) have been created both to (1) define how rendering is to be performed internal to a computer graphics program, and (2) to offer a consistent programming interface for constructing efficient computer graphics rendering programs. A fundamental component of such APIs is that a graphics program must be able to clip images (defined below) to be displayed upon a display device. The images that are displayed often are formed by combining tens of thousands of "primitives" that themselves often are clipped.
Selected terms used in the specification and the accompanying claims are defined as follows:
A primitive is an m-sided polygon having both an inside surface and an outside surface. Attributes (discussed below) are rendered on the outside surface and not on the inside surface. PA1 A frustrum is an n-dimensionally defined viewing area. PA1 Clipping is the process of truncating a line segment that forms part of the perimeter of a primitive shape to the intersection of the line segment with a view area, where the view area is a region defined by view planes, clipping planes, or frustrums, and where only the portion of the primitive within the view area is to be displayed. PA1 Culling is a process for verifying whether the outside surface of a primitive faces away from the viewing and, if so, not rendering that primitive.
A primitive is defined by a collection of vertex points. The vertex points represent the ends of line-segments forming the shape of the primitive. There are at least two types of primitives. The first type is defined by the set of vertices defining the primitive before clipping or culling has been performed. The second is defined by vertices that are generated after the first type of primitive has been clipped and culled. Associated with each initial vertex is data including the spatial-coordinates for the vertex, as well as other information regarding attributes of the primitive at that vertex. Attributes may include color, lighting, texture, shading, fog, reflection, opacity, or other known attributes desired to be tracked and rendered by the graphics program. When the first type of primitive is clipped, a resulting primitive (second type of primitive) is formed having an edge corresponding to the intersection of the first primitive with the view area. The portions of the first primitive that extend over the edge and outside of the view area are discarded. New vertices are formed at the intersections of the primitive component line-segments and the view area.
In the prior art, the attribute values at the initial vertices for the primitive are calculated before clipping or culling. Graphics APIs such as, for example, OpenGL (originally created by Silicon Graphics Systems, Inc.) Often are utilized in calculating attribute values. For more information regarding the OpenGL API standard, "The OpenGL Technical Library" (ISBN 0-201-63276-4; ISBN 0-201-63274-8), published by Addison-Wesley, is incorporated herein by reference. The "OpenGL Reference Manual: The Official Reference Document for OpenGL, Release 1", by the OpenGL Architecture Review Board, published by Addison-Wesley (1992), also is incorporated herein by reference.
FIG. 1 is a flow chart showing an exemplary process used by typical prior art applications for rendering a primitive. The process begins at step 1 in which the graphics rendering system receives the initial vertices corresponding to a primitive to be displayed. At step 2, the vertices are transformed, if necessary, into the coordinate system of the rendering system. At step 3, a check is made to determine whether the primitive may be trivially rejected before proceeding with clipping. If so, processing stops at step 4. If the primitive cannot be trivially rejected, the process continues to steps 5, 6. 7, and 8, in which lighting, texturing, fog, or other attribute values are calculated for the initial vertices of the primitive. At step 9, a test is made to determine whether the primitive must be clipped against the viewing area or other area defined by the user of the rendering system. If clipping is not necessary, then the process skips to step 13 (discussed below). If clipping is necessary, then the primitive is clipped and new vertices are formed corresponding to the edges of the clipped region (step 10)). At step 11, it then is determined whether any portion of the primitive remains in the viewing area after clipping. If no portion remains, then the primitive is rejected at step 12, thus terminating processing. If some portion of the primitive remains, then the process continues to step 13 in which the face direction of the primitive is calculated. Based on the face direction, it then is determined at step 14 whether culling is appropriate. If culling is appropriate, the process terminates (step 15). If culling is not appropriate, then the resulting primitive (i.e., second type of primitive) is displayed (step 16).
One problem with the prior art method shown in FIG. 1 is that many unnecessary calculations for ascertaining attribute values at the initial vertices are performed for primitives that are ultimately culled or completely clipped out of view. Specifically, it is not necessary to calculate the attribute values (which may be computationally intensive) if a primitive is not to be displayed. Doing such calculations therefore is inefficient since it utilizes valuable processor time for making these detailed and unnecessary computations.